#ifndef BIT_STREAM_H
#define BIT_STREAM_H
#include <iostream>
#include "type.h"
namespace swfstream {
class BitStream: std::iostream {
private:
	uint offset;
	int bits_num;
	int nbytes;
	byte n;
public:
	uint32 read_bits(int bits);
	int32 read_s(int bits);
	uint32 read_u(int bits);
	BitStream() {
		offset = 0;
		bits_num = 0;
		nbytes = 0;
	}
	int byte_num() {
		return nbytes;
	}
	void reset();
};
}
#endif
